cmake_minimum_required(VERSION 3.10)
project(carla_rti)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DELPP_THREAD_SAFE -DELPP_NO_DEFAULT_LOG_FILE -DAUTO_INITIALIZE_EASYLOGGINGPP")
set(CMAKE_CXX_STANDARD 14)

add_subdirectory(lib)

# 添加头文件包含路径
include_directories($ENV{RTI_ROOT}/include
        ~/carla/PythonAPI/carla/dependencies/include
        ~/carla/PythonAPI/carla/dependencies/include/system
        ${CMAKE_CURRENT_SOURCE_DIR}/lib/include
        ${CMAKE_CURRENT_SOURCE_DIR}/lib/include/co)
#http://192.168.31.200:80/tu/CoSimulation.git
# 添加库文件路径
link_directories(
        $ENV{RTI_ROOT}/lib
        ~/carla/PythonAPI/carla/dependencies/lib
        ${CMAKE_CURRENT_SOURCE_DIR}/lib/lib)

# 设置编译完成后的输出路径
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/bin/debug)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

# 使用 GLOB 获取所有不同后缀名的源文件
file(GLOB_RECURSE SRC "src/*.cpp" "src/*.cc")

# 创建可执行文件
add_executable(carla_rti ${SRC})

include_directories(
        src/Easylogging/
        src/HwFederateAmbassador/
        src/NlohmannJson/
        src/Utils/
        src/RtiHelper/
        src/SumoIntegration/
)

target_link_libraries(carla_rti CarlaRtiLib RTI-NG fedtime
        -Wl,-Bstatic -lcarla_client -lrpc -lboost_filesystem
        -Wl,-Bdynamic -lpng -ltiff -ljpeg -lRecast -lDetour -lDetourCrowd -pthread)